<div class="main-container" id="main-container" xmlns:th="http://www.thymeleaf.org">
    <div class="main-container-inner">
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <form class="form-horizontal"  role="form" id="update_form" >
                        <input type="hidden" class="form-control" id="uporgCode" name="orgCode" th:attr="value=${id}"/>
                        <input type="hidden" class="form-control" id="upid" name="id"/>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="umyName" class="col-sm-3 control-label">上级机构</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" readonly id="umyName" name="umyName" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="rentCode" class="col-sm-3 control-label">所属客户</label>
                                <div class="col-sm-7">
                                    <select class="form-control" id="rentCode" name="rentCode" >
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="uporgName" class="col-sm-3 control-label">机构名称</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="uporgName" name="orgName" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="uporgUser" class="col-sm-3 control-label">联系人</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="uporgUser" name="orgUser" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="uporgPhone" class="col-sm-3 control-label">联系电话</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="uporgPhone" name="orgPhone" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="uporgAddress" class="col-sm-3 control-label">机构地址</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="uporgAddress" name="orgAddress" />
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        ajaxs('./DOrg/searchByCode/' + $('#uporgCode').val(), 'GET', null, true, function (data) {
            $("#uporgName").val(data.orgName);
            $("#umyName").val(data.extender.myName);
            $("#uporgUser").val(data.orgUser);
            $("#uporgPhone").val(data.orgPhone);
            $("#uporgAddress").val(data.orgAddress);
            $("#upid").val(data.id);
            ajaxs('./DRent/getRentKeyValue', 'GET', null, true, function (typedata) {
                for (var i = 0; i < typedata.length; i++) {
                    if(typedata[i].key==data.rentCode){
                        $("#rentCode").append("<option selected='selected' value=" + typedata[i].key + ">" + typedata[i].value + "</option>");
                    }else {
                        $("#rentCode").append("<option value=" + typedata[i].key + ">" + typedata[i].value + "</option>")
                    }
                }
            });
        });
    });
    function form_sub() {
        ajaxs('./DOrg', 'PUT',$("#update_form").serialize(), true, function(data){
            $("#im_unique_dlg").modal('hide');
            layer.msg(data.message);
            initTree();
        });
    }
</script>